package hu.bme.aut.consulttime.server.entities;

import hu.bme.aut.consulttime.enums.WeekDay;

import java.io.Serializable;
import java.util.Date;

import javax.persistence.AssociationOverride;
import javax.persistence.AssociationOverrides;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.persistence.Transient;

@Entity
@AssociationOverrides({
	@AssociationOverride(name = "studentTeamMembershipId.student", 
		joinColumns = @JoinColumn(name = "studentId")),
	@AssociationOverride(name = "studentTeamMembershipId.team", 
		joinColumns = @JoinColumn(name = "teamId")) })
public class StudentTeamMembership implements Serializable{

	private static final long serialVersionUID = 10L;

	@EmbeddedId
	private StudentTeamMembershipId studentTeamMembershipId;
	
	private WeekDay consultDay;
	
	@Temporal(TemporalType.TIME)
	private Date consultTime;
	
	
	public StudentTeamMembership() {
		super();
	}
	
	

	public StudentTeamMembership(Student student, Team team) {
		super();
		this.studentTeamMembershipId = new StudentTeamMembershipId(student, team);
	}



	public StudentTeamMembershipId getStudentTeamMembershipId() {
		return studentTeamMembershipId;
	}

	public void setStudentTeamMembershipId(
			StudentTeamMembershipId studentTeamMembershipId) {
		this.studentTeamMembershipId = studentTeamMembershipId;
	}
	
	@Transient
	public Student getStudent() {
		return studentTeamMembershipId.getStudent();
	}
 
	public void setStudent(Student student) {
		studentTeamMembershipId.setStudent(student);
	}

	@Transient
	public Team getTeam() {
		return studentTeamMembershipId.getTeam();
	}

	public void setTeam(Team team) {
		studentTeamMembershipId.setTeam(team);
	}

	public WeekDay getConsultDay() {
		return consultDay;
	}

	public void setConsultDay(WeekDay consultDay) {
		this.consultDay = consultDay;
	}

	public Date getConsultTime() {
		return consultTime;
	}

	public void setConsultTime(Date consultTime) {
		this.consultTime = consultTime;
	}
	
}
